Skip to main content

All Questions

Tagged with
4votes
1answer
195views

Finding specific promotions from two columns [closed]

I'm trying to build a function that identifies those who are promoted into a list of jobcodes, or are promoted within that list of jobcodes. Initially I was using ...
Gage's user avatar
1vote
1answer
711views

Exponentially-weighted moving mean and standard deviation of an irregularly-spaced weighted time series

The following numpy/python function computes exponentially-weighted moving mean and standard deviation of an irregularly-spaced weighted time series. I want to make it faster by getting rid of the ...
yuri kilochek's user avatar
3votes
1answer
108views

Vectorizing a working custom similarity function further using numpy

I am new to python, and even more new to vectorization. I have attempted to vectorize a custom similarity function that should return a matrix of pairwise similarities between each row in an input ...
dddxxx's user avatar
2votes
1answer
190views

Computing the angle between two vectors (vectorized) for small angles and with few copies

I am implementing a function that computes the angle between two vectors when given two n-dimensional arrays and an axis along which to operate. I want to do this with as few copies as possible, and ...
FirefoxMetzger's user avatar
5votes
2answers
219views

Snake game from the viewpoint of the snake

I wrote a little game of Snake where you can see the field in which the snake moves fixed and you can also see the "viewpoint" of the snake, which is basically calculating the positions of ...
Javier Camacho's user avatar
5votes
1answer
237views

Implement vectorization instead of nested loops on dataframe

I have a dataset ('sample_data.csv') of the form below: ...
rfguy's user avatar
4votes
1answer
96views

Can this numpy code be vectorized?

I've written the following function to produce n realizations of a CIR process for a given set of parameters: ...
John Smith's user avatar
1vote
0answers
206views

condensed nearest centroid classifier in numpy

This is my attempt to write a numpy-optimized version of a nearest centroid classifier to classify some images from the MNIST data set of handwritten digits. I am ...
Grayscale's user avatar
4votes
2answers
1kviews

PyTorch Vectorized Implementation for Thresholding and Computing Jaccard Index

I have been trying to optimize a code snippet which finds the optimal threshold value in a n_patch * 256 * 256 probability map to get the highest Jaccard index ...
yiping's user avatar
1vote
1answer
506views

Vectorized N-Dimensional Random Walk in Cartesian Coordinates

I have written a random-walk routine that I hope to build upon in the future. Before doing so, I was hoping to get some critique. I believe the implementation is correct. I noticed that many other ...
user avatar
2votes
1answer
7kviews

Find first threshold crossing in numpy array

Given the following artificially generated data: ...
Seanny123's user avatar
6votes
2answers
8kviews

Compute a numerical derivative

Since I could not get numpy.gradient() to compute a derivative successfully, I wrote a script to compute it manually. Running the script below will output a plot of ...
user avatar
3votes
0answers
314views

Merging bin-data via a bin count threshold

When performing a chi-squared test, one takes the square of the differences of the expected counts per bin and observed counts per bin, and divides these per-bin differences by the expected counts per ...
user avatar
1vote
1answer
978views

Normalise list of N dimensional numpy arrays

I have a list of N dimensional NumPy arrays. num_vecs = 10 dims = 2 vecs = np.random.normal(size=(num_vecs, dims)) I want to normalize them, so the magnitude/...
Seanny123's user avatar
6votes
2answers
3kviews

Remove outliers from a point cloud

This function accepts a cloud of points, and returns those points that are within delta distance of the average (mean) position. ...
adrienlucca.net's user avatar

153050per page
close